package main

import (
	"errors"
	"fmt"
	"net/http"
)

func main() {
	req, err := http.NewRequest("GET", "https://v.douyin.com/JXjft1T/", nil)
	if err != nil {
		panic(err)
	}
	client := new(http.Client)
	client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
		return errors.New("Redirect")
	}

	//var redirect string

	response, err := client.Do(req)
	if err != nil {
		if response.StatusCode == http.StatusFound { //status code 302
			fmt.Println(response.Location())
		} else {
			panic(err)
		}
	}

	//urlRe := `https://www.iesdouyin.com/share/video/([0-9+])[.*?]`
	//re := regexp.MustCompile(urlRe)
	//match := re.FindString(content)
	//fmt.Printf(match)
	//for _, m := range match {
	//	fmt.Printf("URL = %s ", m)
	//	fmt.Println()
	//}

}
